import simplejson
from google.appengine.ext import db


class DataObject(db.Model):

    """Represent an individual snippet."""

    # Set automatically
    user = db.UserProperty(auto_current_user_add=True)
    updated = db.DateTimeProperty()#auto_now=True)
    # Manually set
    guid = db.StringProperty(required=True)
    json = db.TextProperty()  # Set to None when object has been deleted.
    session = db.StringProperty(required=True)
    group = db.IntegerProperty()

    def date_str(self):
        return self.updated.strftime('%Y-%m-%d')
